package com.bindapp.adapter;

import android.content.Context;
import android.support.v4.content.ContextCompat;

import com.bindapp.BR;
import com.bindapp.R;
import com.bindapp.listener.RecyclerItemClick;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

/**
 * Created by apple on 2018/6/29.
 */

public class MainTab1TwoAdapter extends BaseRcAdapter {
    private Context context;
    private List<String> labellist;
    public MainTab1TwoAdapter(Context context,List<Object> datas, int layoutId, int mVariableId, RecyclerItemClick listener) {
        super(datas, layoutId, mVariableId, listener);
        this.context=context;
        labellist=new ArrayList<String>();
        labellist.addAll(Arrays.asList(context.getResources().getStringArray(R.array.tab1twolabel)));
    }

    @Override
    public void BinderHolder(BaseHolder holder, int position) {
        if(holder instanceof ContentHolder){
            holder.getBinding().setVariable(mVariableId,ContextCompat.getDrawable(context,(int)datas.get(position)));
            ((ContentHolder)holder).getBinding().setVariable(BR.tabname,labellist.get(position));


        }
    }
}
